package xyz.luhui1hao.sell.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.luhui1hao.sell.domain.ProductCategory;
import xyz.luhui1hao.sell.mapper.ProductCategoryMapper;
import xyz.luhui1hao.sell.service.CategoryService;

import java.util.List;

/**
 * @ClassName CategoryServiceImpl
 * @Description TODO
 * @Author luhui1hao
 * @Date 2018/8/16 下午9:53
 * @Version 1.0
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private ProductCategoryMapper productCategoryMapper;

    @Override
    public ProductCategory findOne(Integer categoryId) {
        ProductCategory productCategory = productCategoryMapper.findOne(categoryId);
        return productCategory;
    }

    @Override
    public List<ProductCategory> findAll() {
        List<ProductCategory> list = productCategoryMapper.findAll();
        return list;
    }

    @Override
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) {
        List<ProductCategory> list = productCategoryMapper.findByCategoryTypeIn(categoryTypeList);
        return list;
    }

    @Override
    public ProductCategory insertProductCategory(ProductCategory productCategory) {
        int count = productCategoryMapper.insertProductCategory(productCategory);
        //TODO
        return productCategory;
    }

    @Override
    public int updateProductCategory(ProductCategory productCategory) {
        int count = productCategoryMapper.updateProductCategory(productCategory);
        return count;
    }
}
